import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class db
{
	static String userName = "bot";
	static String userPassword = "123";
	static String databaseUrl = "jdbc:mysql://localhost:3306/bot";
	public static String get (String field) {
		String r = null;
		try {
			Class.forName ("com.mysql.jdbc.Driver").newInstance ();				
			Connection conn = DriverManager.getConnection (databaseUrl, userName, userPassword);
			Statement stat = conn.createStatement();	
			String query = "select * from settings";
			ResultSet result = stat.executeQuery(query);
			while(result.next()){ 
				r = result.getString(field);
			}	
			conn.close();
			return r;
		}
		catch (SQLException e) { System.out.println("Error: " + e);  }
		catch (InstantiationException e) { System.out.println("Error: " + e); }			
		catch (IllegalAccessException e) { System.out.println("Error: " + e); } 
		catch (ClassNotFoundException e) { System.out.println("Error: " + e); }
		return null;
	}   
}
